package cn.edu.zut.hhr;

import cn.edu.zut.hhr.service.ArticleService;
import cn.edu.zut.hhr.utils.RedisUtil;
import cn.edu.zut.hhr.utils.StatisticsUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@MapperScan("cn.edu.zut.hhr.mapper")
@SpringBootApplication
@EnableSwagger2
//@EnableWebMvc
public class BlogApp {

    public static void main(String[] args) {
        ApplicationContext ac = SpringApplication.run(BlogApp.class,args);
        RedisUtil redisUtil = ac.getBean("redisUtil", RedisUtil.class);
        ArticleService articleService = ac.getBean(ArticleService.class);
        StatisticsUtil.setArticleService(articleService);
        StatisticsUtil.setRedisUtil(redisUtil);
    }

}
